package awk.designModel.factory.absfactory;

//工厂制造者
public class FactoryProducer {

	//测试主方法
	public static void main(String[] args) {
		AbstractFactory shapeFactory = FactoryProducer.getFactory("SHAPE");
		AbstractFactory colorFactory = FactoryProducer.getFactory("COLOR");
		Shape circle = shapeFactory.getShape("Circle");
		Color red = colorFactory.getColor("red");
		circle.draw();
		red.fill();
	}

	public static AbstractFactory getFactory(String choice){
		if(choice.equalsIgnoreCase("SHAPE")){
			return new ShapeFactory();
		}else if(choice.equalsIgnoreCase("COLOR")){
			return new ColorFactory();
		}else{
			System.out.println("::请输入正确工厂名称");
			return null;
		}
	}
}